export default class ScorePanel {
    score: number;

    level: number;

    levelElement: HTMLElement;

    scoreElement: HTMLElement;

    constructor(private maxLevel: number = 10, private upScore: number = 10) {
      this.scoreElement = document.getElementById('score')!;
      this.levelElement = document.getElementById('level')!;
      this.score = 0;
      this.level = 1;
    }

    addScore() {
      this.score += 1;
      this.scoreElement.innerHTML = `${this.score}`;

      if (this.score % this.upScore === 0) {
        this.levelUp();
      }
    }

    levelUp() {
      if (this.level < this.maxLevel) {
        this.level += 1;
        this.levelElement.innerHTML = `${this.level}`;
      }
    }
}
